#!/usr/bin/perl

use warnings;
use strict;

print "Please enter 5 of your favirote fruits:\n";
my $foods = q{};
my $i = 0;
while ($i < 5) {
    chomp(my $temp = <STDIN>);
    if ($foods eq "") {
        $foods = $temp;
    } else {
        $foods = "$foods:$temp";
    }
    $i++;
}

my @foods_array = split (':', $foods);
foreach (@foods_array) {
    print "$_ ";
}
print "\n";

print $foods_array[0], " ", $foods_array[-1], "\n";

print ($#foods_array + 1);
print "\n";

my @part_foods_array = splice (@foods_array, 1, 3);

print @part_foods_array;
